﻿namespace HuaWei.EI
{
    using HuaWei.CommClass;
    using HuaWei.Common;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Data;
    using System.Runtime.InteropServices;

    public class ExportRemote : ExportBase, IExport
    {
        public ExportRemote(string bdid, string qcid, string bdName)
        {
            base.IniExport(qcid, bdid, bdName);
        }

        public bool CBRExpJLData()
        {
            Class39.smethod5(base.QCID, GParams._BDID, GParams._XMID, GParams._YZID);
            if (!base.CheckExportData())
            {
                return false;
            }
            base.method7(GParams._JGLX);
            return this.method10("UpdateJLData", base.dsSource, "");
        }

        public bool ExpDataByJGLX()
        {
            if (GParams._JGLX.Equals(JGLX.CBR))
            {
                return this.CBRExpJLData();
            }
            if (GParams._JGLX.Equals(JGLX.JL))
            {
                return this.imethod_1();
            }
            if (GParams._JGLX.Equals(JGLX.YZ))
            {
                return this.imethod_2();
            }
            return true;
        }

        public bool imethod_0()
        {
            new List<string>().Add(GParams.LoginId);
            ArrayList sQlList = new ArrayList();
            base.method8(sQlList);
            if (this.method10("UpdateXMData", base.dsSource, "数据已成功提交到服务器！"))
            {
                base.ida.ExecuteNonQuery(sQlList, CommandType.Text);
                return true;
            }
            return false;
        }

        public bool imethod_1()
        {
            Class39.smethod5(base.QCID, GParams._BDID, GParams._XMID, GParams._YZID);
            if (!base.CheckExportData())
            {
                return false;
            }
            base.method7(GParams._JGLX);
            return this.method10("UpdateJLData", base.dsSource, "");
        }

        public bool imethod_2()
        {
            Class39.smethod5(base.QCID, GParams._BDID, GParams._XMID, GParams._YZID);
            if (!base.CheckExportData())
            {
                return false;
            }
            Class39.smethod15(base.BDID, base.QCID, GParams._XMID, GParams._YZID, false, false);
            base.method7(GParams._JGLX);
            return this.method10("UpdateJLData", base.dsSource, "");
        }

        public bool imethod_3()
        {
            base.method6(true);
            return this.method10("UpdateXMData", base.dsSource, "");
        }

        public bool JLExpDelJLData(string filePath)
        {
            throw new NotImplementedException();
        }

        private bool method10(string _str3, DataSet dataSet, [Optional, DefaultParameterValue("")] string _str4)
        {
            return Class38.smethod1(_str3, dataSet, GParams.LoginId, base.BDID, base.QCID, _str4);
        }

        public bool YZExpBGLData()
        {
            base.BuildBGLData();
            if (this.method10("UpdateXMData", base.dsSource, ""))
            {
                string exeStr = string.Format("update {0} set updateStatus=0 where updateStatus>0 and  and bdid='{1}'", "BGL", base.BDID);
                base.ExecuteSql(exeStr);
                return true;
            }
            return false;
        }
    }
}

